package com.share.thread;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @desc:
 * @author:caifan
 * @date:2022/3/25
 */
public class ThreadLocalDemo01 {

    public static void main(String[] args) throws InterruptedException {
        ThreadLocalDemo01 threadLocalDemo01 = new ThreadLocalDemo01();
        for (int i = 1; i <= 10; i++) {
            int finalI = i;
            new Thread(() -> {
                String date = threadLocalDemo01.date(finalI);
                System.out.println(date);
            }).start();
            Thread.sleep(100);
        }

//        new Thread(() -> {
//            String date = new ThreadLocalDemo01().date(2);
//            System.out.println(date);
//        }).start();
    }

    public String date(int seconds) {
        Date date = new Date(1000 * seconds);
        SimpleDateFormat format = new SimpleDateFormat("mm:ss");
        return format.format(date);
    }
}
